Product : ISaGRAF V3

Date    : 5 March 1996

File    : accres.access to resources of one application.htm

Subject : access to application resources from the target software

Keywords: Resource

____________________________________________________________________

Below are some explanations about how to use resources in ISaGRAF V3

target software:

 

- the code of the application resources is fully integrated in the

ISaGRAF application code(TIC), and downloaded with the application.

- the ISaGRAF target does not provide any copy function for

resources (copy to files or data modules)

 

The function apl_def_resource from ISaGRAF kernel may be used to

have access to the description of one resource. Below is the

prototype of this function:

 

uchar *apl_def_resource (uint16 resource_number);

 

The "resource_number" parameter is the order number of the resource

in the resource directory (from 0 to N-1). It does not have any

correspondance with the resource definition file at the source

level. The function returns a pointer to a structure which defines

the selected resource. It returns NULL (0) if the selected number

is not a valid resource number.

 

Below is an example of a resource scanning algorithm:

 

uint16 res_num;

uchar *res_definition;

 

res_num = 0;

while ((res_definition = apl_def_resource (res_num)) != 0)

{

    /* operate *res_definition */

    res_num += 1;

}

 

Below is the format of a resource definition structure:

 

{

    char name[16];

    long type;          /* 1=binaryfile - 2=textfile -

                        3=ulongdata - 4=varlist */

    long size;          /* exact size of data */

    uint32 data;

    uint32 path_offset;  /* offset to be used to

                         points to a string terminated by 0 */

                        /* unused for ulongdata resources */

}

 

For text file resources, end-of-line characters are converted by the

resource compiler according to the target system conventions. All

pointers are 32 bit offsets from the base address of the

corresponding structure. All resource names and pathnames are

terminated by null characters.

 

Pathnames and resource data are stored after the resource directory

in the downloaded code:

Examples are provided in directory "accres.examples to access resources"

or ask to support@altersys.com

____________________________________________________________________

Copyright © 1996-2009 ICS Triplex ISaGRAF Inc. All rights reserved.